#ifndef __PID_H
#define __PID_H

//--------------------------[头与宏定义]-----------------------------------------------------



//--------------------------【结构体】-----------------------------------------------------

typedef struct PID_PARAMETER
{
    float Kp;
    float Ki;
    float Kd;
    float error_now;
    float error_last;
    float error_inter;
    int pid_out;
    float limit;//输出限幅，根据说明书确定，注意不是电机的堵转保护
    
} PID;











//--------------------------【全局变量&函数】-----------------------------------------------------
extern PID PTZ_Motor_PID_Position_P,PTZ_Motor_PID_Speed_P,PTZ_Motor_PID_Torque_P;
extern PID PTZ_Motor_PID_Position_Y,PTZ_Motor_PID_Speed_Y,PTZ_Motor_PID_Torque_Y;
extern PID Hit_position, Hit_speed;

void PID_Init(void);
void PID_Control(float current,float expected,PID *motor_type);
void PID_Control_with_limit(float current, float expected, PID *motor_type);

#endif
